home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 2.5 KB | 144 lines | [TEXT/MPS ] |
- /*
- File: CReport.cp
-
- Contains: xxx put contents here xxx
-
- Written by: Tim Harnett
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <1> 12/12/94 TMH seperated for MailHandler.cp
- 12/5/94 TMH xxx put comment here xxx
-
- To Do:
- */
-
- #ifndef __STRING__
- #include "String.h"
- #endif
-
- #ifndef __Globals__
- #include "Globals.h"
- #endif
-
- #ifndef __Debug__
- #include "Debug.h"
- #endif
-
-
- #ifndef __CDSSpec__
- #include "CDSSpec.h"
- #endif
-
- #ifndef __CReport__
- #include "CReport.h"
- #endif
-
- #ifndef __TThread__
- #include "TThread.h"
- #endif
-
-
- //----------------------------
- // C R e p o r t
- //----------------------------
-
-
- //-------------------------------------------------------------------------
- CReport::CReport(MailMsgRef msgRef,MailLetterID letterID)
- {
- fMsgRef = msgRef;
- fLetterID = letterID;
-
- fReportRef = 0;
- memset(&fPB,0,sizeof(MSAMParam));
- }
-
-
- //-------------------------------------------------------------------------
- CReport::~CReport()
- {
- if(fReportRef != 0 )
- this->Submit(false);
- }
-
-
- //------------------------------------------------------------------------
- OSErr CReport::Create()
- {
-
- fPB.header.ioCompletion = 0;
- fPB.msamCreateReport.msgID = fLetterID;
-
-
- CRecipientIterator fromIter(fMsgRef,kMailFromBit);
- OrigRecipient* fromRecip = fromIter.FirstRecipient();
- CUnpackedDSSpec sender(&fromRecip->packedRecip);
-
- fPB.msamCreateReport.sender = (MailRecipient*)&sender;
-
-
- MSAMCreateReport(&fPB,true);
- do {
- gCurrentThread->Yield();
- } while( fPB.header.ioResult > 0 );
-
-
- ASSERTNOERR(fPB.header.ioResult);
-
- fReportRef = fPB.msamCreateReport.mailMsgRef;
-
- return fPB.header.ioResult;
-
- }
-
-
- //------------------------------------------------------------------------
- OSErr CReport::Submit(Boolean submit)
- {
- ASSERT(fReportRef!=0);
-
- fPB.msamSubmit.mailMsgRef = fReportRef;
- fPB.msamSubmit.submitFlag = submit;
-
- OSErr osErr = MSAMSubmit(&fPB);
- ASSERTNOERR(osErr);
-
- fReportRef = 0;
-
- return osErr;
-
- }
-
-
-
-
- //------------------------------------------------------------------------
- OSErr CReport::PutRecipientReport(OSErr reportErr,ResolvedRecipient* resolvedRecipient)
- {
-
- fPB.msamPutRecipientReport.mailMsgRef = fReportRef;
- fPB.msamPutRecipientReport.recipientIndex = resolvedRecipient->ext.index; // the report index
- fPB.msamPutRecipientReport.result = reportErr;
-
-
- MSAMPutRecipientReport(&fPB,true);
- do {
- gCurrentThread->Yield();
- } while( fPB.header.ioResult > 0 );
-
-
- ASSERTNOERR(fPB.header.ioResult);
-
- return fPB.header.ioResult;
- }
-
-
-
-
-
-
- //•••
-